<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="cn.kgc.pojo.News" %>
<%@ include file="../common/common.jsp"%>
<html>
	<head>
		<link href="<%=request.getContextPath() %>/css/common.css" rel="stylesheet" type="text/css" />
		<script type="text/javascript" src="<%=request.getContextPath() %>/ckeditor/ckeditor.js"> </script>
	</head>
<body>
<%
	int id = Integer.parseInt(request.getParameter("id"));
	News news = newsService.getNewsListById(id);
	int categoryId = news.getCategoryId();
	String title = news.getTitle();
	String summary = news.getSummary();
	String content = news.getContent();
	String picpath = news.getPicPath();
	String author = news.getAuthor();
%>
<form name ="dataFrm" id="dataFrm" action="<%=request.getContextPath()%>/jsp/admin/doNewsUpdate.jsp" method="post" enctype="multipart/form-data">
	<table  width="100%" border="0" cellspacing="5" cellpadding="0">
		<thead>
			<tr><td align="center" colspan="2" class="text_tabledetail2">增加新闻</td></tr>
		</thead>
		<tbody>
			<tr>
				<td>
					<input type="hidden" name="picpath2" value="<%=picpath%>"/>
				</td>
				<td>
					<input type="hidden" name="id" value="<%=id%>"/>
				</td>
			</tr>
			<tr>
				<td style="text-align:right;" class="text_tabledetail2">分类</td>
				<td style="text-align:left;">
				<!-- 列出所有的新闻分类 -->
					<select name="categoryId">
						<%if (1 == categoryId){%>
						<option value="1" selected="selected">国内</option>
						<%}else{%>
						<option value="1" selected="selected">国内</option>
						<%}%>

						<%if (2 == categoryId){%>
						<option value="2" selected="selected">国际</option>
						<%}else{%>
						<option value="2">国际</option>
						<%}%>

						<%if (3 == categoryId){%>
						<option value="3" selected="selected">娱乐</option>
						<%}else{%>
						<option value="3">娱乐</option>
						<%}%>

						<%if (4 == categoryId){%>
						<option value="4" selected="selected">军事</option>
						<%}else{%>
						<option value="4">军事</option>
						<%}%>

						<%if (5 == categoryId){%>
						<option value="5" selected="selected">财经</option>
						<%}else{%>
						<option value="5">财经</option>
						<%}%>

						<%if (6 == categoryId){%>
						<option value="6" selected="selected">天气</option>
						<%}else{%>
						<option value="6">天气</option>
						<%}%>
	        		</select>
				</td>
			</tr>
			<tr>
				<td style="text-align:right;" class="text_tabledetail2">标题</td>
				<td style="text-align:left;">
					<input type="text" name="title" value="<%=title%>"/>
				</td>
			</tr>
			<tr>
				<td style="text-align:right;" class="text_tabledetail2">作者</td>
				<td style="text-align:left;">
					<input type="text" name="author" value="<%=author%>"/>
				</td>
			</tr>
			
			<tr>
				<td style="text-align:right;" class="text_tabledetail2">摘要</td>
				<td style="text-align:left;">
					<textarea id="summary" name="summary" rows="8" cols="50"><%=summary%></textarea>
				</td>
			</tr>
			<tr>
				<td style="text-align:right;" class="text_tabledetail2">内容</td>
				<td style="text-align:left;">
				<div id="xToolbar"></div>
					<textarea id="newscontent" name="newscontent" rows="8" cols="30" class="ckeditor"><%=content%></textarea>
				</td>
			</tr>
			<tr>
				<td style="text-align:right;" class="text_tabledetail2">上传图片</td>
				<td style="text-align:left;">
					<input type="file" name="picPath" value="<%=picpath%>"/>
				</td>
			</tr>
			<tr>
				<td style="text-align:center;" colspan="2">
					<button type="submit" class="page-btn" name="save">保存</button>
					<button type="button" class="page-btn" name="return"
							onclick="javascript:location.href='newsDetailList.jsp'">返回</button>
				</td>
			</tr>
		</tbody>
	</table>
</form>
</body>
</html>